<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>客户管理</title>
	<meta name="decorator" content="default"/>
</head>
<body>
	<div data-role="navbar">
		<ul>
			<li><a href="#" class="ui-btn-active">客户基本资料</a></li>
			<li><a href="${ctx}/expert/customerExam/list">专家方案</a></li>
			<li><a href="${ctx}/base/customer/cards">客户卡信息</a></li>
			<li><a href="${ctx}/base/customer/consume">客户消费记录</a></li>
		</ul>
	</div>
	<form:form id="inputForm" modelAttribute="customer" action="${ctx}/base/customer/save" method="post" class="form-input">
		<form:hidden path="id"/>
		<form:hidden path="store.id" value="${fns:getStore().id}"/>
		<tags:message content="${message}"/>
		<c:set var="emsId" scope="session" value="${emsId}"></c:set>
		<c:set var="customerId" scope="session" value="${customer.id}"></c:set>
		<div class="icon-buttons">
			<a id="returnBtn" class="leave-detail" data-role="button" data-inline="true" data-icon="back" data-iconpos="notext"  href="#">返 回</a>
			<a id="editBtn" data-role="button" data-inline="true" data-icon="edit" data-iconpos="notext" onclick="loginPasswordPopup('${ctx}/base/customer/form?id=${customer.id}')">修改</a>
		</div>
		<div data-role="collapsible" data-collapsed="false" >
		    <h5>基本信息</h5>
			<label class="detail-label">姓名：</label>${customer.name}<br/>
			<label class="detail-label">备注名：</label>${not empty customer.nickname ? customer.nickname : '无'}<br/>
			<label class="detail-label">性别：</label>${fns:getDictLabel(customer.gender, 'gender', '')}<br/>
			<label class="detail-label">年龄：</label>${fns:getAge(customer.birthday)}<br/>
			<label class="detail-label">体重(千克)：</label>${not empty customer.weight && customer.weight != 0 ? customer.weight:'未填写'}
		</div>
		<div data-role="collapsible" data-collapsed="false" >
		    <h5>联系方式</h5>
			<label class="detail-label">手机：</label>${not empty customer.mobile ? customer.mobile : '未填写'}<br/>
			<label class="detail-label">固定电话：</label>${not empty customer.phone ? customer.phone : '未填写'}<br/>
			<label class="detail-label">邮箱地址：</label>${not empty customer.email ? customer.email : '未填写'}<br/>
			<label class="detail-label">住址：</label>${not empty customer.address ? customer.address : '未填写'}
		</div>
		<div data-role="collapsible" data-collapsed="false" >
		    <h5>家庭状况</h5>
			<label class="detail-label">婚姻状况：</label>${fns:getDictLabel(customer.marry, 'marry', '')}<br/>
			<label class="detail-label">子女(个)：</label>${customer.childs == 0 ? '无' : customer.childs}<br/>
			<label class="detail-label">居住环境：</label>${fns:getDictLabel(customer.live_condition, 'live_condition', '')}
		</div>
		<div data-role="collapsible" data-collapsed="false" >
		    <h5>工作状况</h5>
			<label class="detail-label">工作性质：</label>${not empty customer.work_nature ? customer.work_nature : '未填写'}<br/>
			<label class="detail-label">工作场所：</label>${fns:getDictLabel(customer.workplace, 'workplace', '')}
		</div>
		<div data-role="collapsible" data-collapsed="false" >
		    <h5>专属美容师</h5>
			<c:forEach items="${ceList}" var="ce">
				<label class="detail-label">${ce.employee.name}</label><br/>
			</c:forEach>
		</div>
	</form:form>
	<script type="text/javascript">
		$(document).ready(function() {	
			//离开本模块时,清除使用过的session
			$(".leave-detail").click(function(){
				sessionStorage.removeItem("target");
				var target = this.href;
				var url = "${ctx}/cleanSession?sessionKeys=emsId,customerId";
				var backFun = function(){
					window.location.href = target;
		 		};
		 		syncToServer(url, backFun);
				return false;
			});
			initCustomerDetailReturnButton("${ctx}", "${emsId}", "${customerId}");
		});
	</script>
</body>
</html>
